﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Globalization;
using System.Linq;
using System.Web;

/// <summary>
/// Class1 的摘要说明
/// </summary>
public class TEST

{
    public int[] StrToInt(string[] arr)
    {
        int[] numbers = new int[arr.Length];
        for (int i = 0; i < arr.Length; i++)
        {
            numbers[i] = Convert.ToInt32(arr[i]);
        }
        return numbers;
    }

    public int Max(string[] arr)
    {
        int[] numbers = StrToInt(arr);
        int imax = -99999999;
        for (int i = 0; i < numbers.Length; i++)
        {
            if (numbers[i] > imax)
            {
                imax = numbers[i];
            }
        }
        return imax;
    }

    public int Min(string[] arr)
    {
        int[] numbers = StrToInt(arr);
        int imin = 99999999;
        for (int i = 0; i < numbers.Length; i++)
        {
            if (numbers[i] < imin)
            {
                imin = numbers[i];
            }
        }
        return imin;
    }

    public int[] SortieUP(string[] arr, int numbers)
    {
        int[] number = StrToInt(arr);
        
        for (int i = 0; i < number.Length - 1; i++)
        {
            for (int j = 0; j < number.Length - i - 1; j++)
            {
                if (number[j] > number[j + 1])
                {
                    int temp = number[j];
                    number[j] = number[j + 1];
                    number[j + 1] = temp;
                }
            }
        }

        return number;
    }

    public int[] SortieDOWN(string[] arr, int numbers)
    {
        int[] number = StrToInt(arr);

        for (int i = 0; i < number.Length - 1; i++)
        {
            for (int j = 0; j < number.Length - i - 1; j++)
            {
                if (number[j] > number[j + 1])
                {
                    int temp = number[j];
                    number[j] = number[j + 1];
                    number[j + 1] = temp;
                }
            }
        }

        return number;
    }
}










